<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div th:fragment="nav">

        <link rel="stylesheet" th:href="@{/static/css/bootstrap.min.css}">

        <script type="text/javascript" th:src="@{/static/js/jquery-1.10.2.min.js}"></script>
        <script th:src="@{/static/js/bootstrap.min.js}"></script>

        <script>
            function logout() {
                $("#logoutButton").click();
            }
        </script>
        <div class="row">
        <nav class="navbar navbar-default container">
            <div class="container">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a href="#" class="navbar-brand" >
                        传智工作室
                    </a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li th:class="${page_share}!=null?'active'"><a th:href="@{/?size=5&sort=publishTime,desc}">动态<span class="sr-only">(current)</span></a></li>
                        <li th:class="${page_voteList}!=null?'active'"><a th:href="@{/voteList.html?size=5&sort=createDate,desc}">投票</a></li>
                        <li th:class="${page_staff}!=null?'active'"><a th:href="@{/staff.html}">人员</a></li>
                    </ul>
                    <ul class="nav navbar-nav navbar-right" sec:authorize="${authenticated}">
                        <li><a th:href="@{/me.html}" th:text="${#authentication.principal.username}">Link</a></li>
                            <form th:action="@{/logout}" method="POST" style="display: none">
                                <input type="hidden" name="${_csrf.headerName}" value="${_csrf.token}"/>
                                <input type="submit" id="logoutButton" />
                            </form>
                        <li><a onclick="logout()" style="cursor: hand">退出</a></li>
                    </ul>
                    <form class="navbar-form navbar-right" action="/search" method="get">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Search" name="keyword">
                        </div>
                        <button type="submit" class="btn btn-default">搜索</button>
                    </form>
                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->
        </nav>
        </div>
    </div>

<div th:fragment="meLeft">
    <div class="col-xs-2">
        <ul class="nav nav-pills nav-stacked">
            <li role="presentation" th:class="${page_me}!=null?'active'"><a th:href="@{/me.html}">个人信息</a></li>
            <li role="presentation" th:class="${page_password}!=null?'active'"><a th:href="@{/password.html}">修改密码</a></li>
            <li role="presentation" th:class="${page_newVote}!=null?'active'"><a th:href="@{/newVote.html}">发起投票</a></li>
            <li role="presentation" th:class="${page_newShare}!=null?'active'"><a th:href="@{/newShare.html}">Share</a></li>
        </ul>
    </div>
</div>
</body>
</html>